<template>
  <component :is="type" :name="name" :value="value" :config="config" :is_info="is_info" :size="size" :is_list="is_list"
             @update:value="$emit('update:value', $event)" @change="$emit('change', $event)"
             v-bind="$attrs"
  ></component>
</template>

<script>
import {field_type} from "@/js/tool.js";
import {defineAsyncComponent} from "vue";

let components = {};
Object.keys(field_type.map).forEach(key=>{
  components[key] = defineAsyncComponent(()=>import(`./form_item/${key}.vue`));
})

export default {
  name: "s94_param",
  components,
  props: {
    type: String,
    name: {type:String, default:''},
    value: {type:[String,Number,Object,Array], default:''},
    config: [String, Object],
    is_info: Boolean,
    size: String,
    is_list: Boolean
  },
  emits: ['update:value', 'change'],
  mounted() {

  }
}
</script>

<style scoped>

</style>